class ReplyContent {
  ReplyContent(
      {this.message,
      this.atNameToMid, // @的用户的mid null
      this.memebers, // 被@的用户List 如果有的话 []
      this.emote, // 表情包 如果有的话 null
      this.jumpUrl, // {}
      this.pictures, // {}
      this.vote,
      this.richText});

  String? message;
  Map? atNameToMid;
  List? memebers;
  Map? emote;
  Map? jumpUrl;
  List? pictures;
  Map? vote;
  Map? richText;

  ReplyContent.fromJson(Map<String, dynamic> json) {
    message = json['message'];
    atNameToMid = json['at_name_to_mid'] ?? {};
    memebers = json['memebers'] ?? [];
    emote = json['emote'] ?? {};
    jumpUrl = json['jump_url'] ?? {};
    pictures = json['pictures'] ?? [];
    vote = json['vote'] ?? {};
    richText = json['rich_text'] ?? {};
  }

  ContentEmoji? getEmoji(String emoteKey) {
    if (emote?.containsKey(emoteKey) ?? false) {
      return ContentEmoji.fromJson(emote![emoteKey]);
    }
    return null;
  }
}

class ContentEmoji {
  int? id;
  int? packageId;
  int? state;
  int? type;
  int? attr;
  String? text;
  String? url;
  ContentMeta? meta;
  int? mtime;
  String? jumpTitle;

  ContentEmoji({
    this.id = 0,
    this.packageId = 0,
    this.state = 0,
    this.type = 0,
    this.attr = 0,
    this.text,
    this.url,
    this.meta,
    this.mtime = 0,
    this.jumpTitle,
  });

  factory ContentEmoji.fromJson(Map<String, dynamic> json) => ContentEmoji(
        id: json["id"],
        packageId: json["package_id"],
        state: json["state"],
        type: json["type"],
        attr: json["attr"],
        text: json["text"],
        url: json["url"],
        meta: ContentMeta.fromJson(json["meta"]),
        mtime: json["mtime"],
        jumpTitle: json["jump_title"],
      );
}

class ContentMeta {
  int? size;
  List<dynamic>? suggest;

  ContentMeta({
    this.size = 0,
    this.suggest,
  });

  factory ContentMeta.fromJson(Map<String, dynamic> json) => ContentMeta(
        size: json["size"],
        suggest: List<dynamic>.from(
            json["suggest"]?.map((x) => x) ?? const Iterable.empty()),
      );
}

class ContentPicture {
  String? imgSrc;
  int? imgWidth;
  int? imgHeight;
  double? imgSize;
  String? topRightIcon;
  bool? playGifThumbnail;

  ContentPicture({
    this.imgSrc,
    this.imgWidth = 0,
    this.imgHeight = 0,
    this.imgSize = 0,
    this.topRightIcon,
    this.playGifThumbnail = false,
  });

  factory ContentPicture.fromJson(Map<String, dynamic> json) => ContentPicture(
        imgSrc: json["img_src"],
        imgWidth: json["img_width"],
        imgHeight: json["img_height"],
        imgSize: json["img_size"] != null ? json["img_size"].toDouble() : 0,
        topRightIcon: json["top_right_icon"],
        playGifThumbnail: json["play_gif_thumbnail"],
      );
}
